<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
    <meta charset="utf-8" />
    <link rel="stylesheet" type="text/css" href="${path}/css/public.css" />
    <link rel="stylesheet"
          href="${path}/css/themes/base/jquery.ui.all.css">
    <link rel="stylesheet" href="${path}/js/demos.css">

    <script type="text/javascript"
            src="${path}/js/jquery-1.7.2.js"></script>
    <script type="text/javascript"
            src="${path}/js/jquery.ui.core.js"></script>
    <script type="text/javascript"
            src="${path}/js/jquery.ui.widget.js"></script>
    <script type="text/javascript"
            src="${path}/js/jquery.ui.position.js"></script>
    <script type="text/javascript"
            src="${path}/js/jquery.ui.autocomplete.js"></script>
    <script type="text/javascript"
            src="${path}/js/jquery.ui.datepicker.js"></script>
    <script type="text/javascript"
            src="${path}/js/jquery.ui.datepicker-zh-CN.js"></script>
    <script src="${path}/js/jquery.ui.button.js"></script>
    <link rel="stylesheet" href="${path}/css/icons.css">
    <script src="${path}/js/icons.js"></script>


    <title>i18n.title.customer.sea
    </title>
</head>
<body>
<!--头部-->
<div class="header">




    <div class="top">
        <div class="top_left">
            <span class="f1">欢迎您：ADMIN</span>
        </div>
        <div class="top_right">
            <a href="${path}/toIndex.action" class="top_ico0">首页</a>
            <a href="${path}/initUpdatePassword.action" class="top_ico1">修改密码</a>
            <a href="${path}/user/initPersonalInfo.action" class="top_ico2">个人信息</a>
            <a href="${path}/logout.action" class="top_ico3">退出</a>
        </div>
    </div>
    <div class="top2">
        <p class="pro_id">客户关系管理系统  小管版本</p>
    </div>
</div>

<!--主体-->
<table class="main" border="0"
       style="width: 100%; background-color: #FFFFFF">
    <tr>
        <td width="140" style="vertical-align: top;">
            <div class="main_left">



                <script type="text/javascript" src="${path}/js/jquery.ui.accordion.js"></script>

                <script type="text/javascript">
                    $().ready(function() {
                        $('.menuTitle').click(function() {//添加menuTitle的click事件
                            if ($(this).next().is(":hidden")) {//隐藏判断
                                $('.menu_ul_div').slideUp();//隐藏 */
                                $(this).next().slideDown();//显示
                            } else {
                                if ($(this).next().attr("id") == 'menu_ul_div_1') {

                                    $('.menu_ul_div').slideUp();//隐藏 */
                                    $('#menu_ul_div_2').slideDown();//显示

                                }
                                ;
                                if ($(this).next().attr("id") == 'menu_ul_div_2') {

                                    $('.menu_ul_div').slideUp();//隐藏 */
                                    $('#menu_ul_div_3').slideDown();//显示

                                }
                                ;
                                if ($(this).next().attr("id") == 'menu_ul_div_3') {

                                    $('.menu_ul_div').slideUp();//隐藏 */
                                    $('#menu_ul_div_4').slideDown();//显示

                                }
                                if ($(this).next().attr("id") == 'menu_ul_div_4') {

                                    $('.menu_ul_div').slideUp();//隐藏 */
                                    $('#menu_ul_div_1').slideDown();//显示

                                }
                            }
                        });
                    });
                </script>
                <div class="sidebar">

                    <h2 id="menu1" class="menuTitle">客户管理</h2>
                    <div class="menu_ul_div" id="menu_ul_div_1"
                         style="display:block;"
                    >
                        <ul id="menu1_ul" class="menu_ul">
                            <li class="menuItem"><a href="${path}/customer/initConflict.action">客户冲突</a></li>
                            <li class="menuItem"><a href="${path}/customer/initAdd.action">添加客户</a></li>
                            <li class="menuItem"><a href="${path}/customer/initServe.action">服务中签约客户</a></li>
                            <li class="menuItem"><a href="${path}/customer/initNoServe.action">未签约客户</a></li>
                            <li class="menuItem"><a href="${path}/customer/initNoServeFirst.action">未签约-已初试</a></li>
                            <li class="menuItem"><a href="${path}/customer/initNoServeSecond.action">未签约-已复试</a></li>
                            <li class="menuItem"><a href="${path}/customer/getAllSea.action">公海客户</a></li>
                            <li class="menuItem"><a href="${path}/visitRecord/initSearch.action">拜访查询</a></li>
                        </ul>
                    </div>


                    <h2 id="menu2" class="menuTitle">合同管理</h2>
                    <div class="menu_ul_div" id="menu_ul_div_2"

                         style="display:none;">
                        <ul id="menu2_ul" class="menu_ul">
                            <li class="menuItem"><a href="${path}/contractTemplate/initList.action">合同模版</a></li>
                            <li class="menuItem"><a href="${path}/contract/initAdd.action">新增合同</a></li>
                            <li class="menuItem"><a href="${path}/contract/initContractValid.action">有效合同查询</a></li>
                            <li class="menuItem"><a href="${path}/contract/initContractInvalid.action">无效合同查询</a></li>
                            <li class="menuItem"><a href="${path}/contract/initPaymentReceivable.action">应收款查询</a></li>
                            <li class="menuItem"><a href="${path}/contract/initPaymentReceived.action">到款查询</a></li>
                        </ul>
                    </div>


                    <h2 id="menu3" class="menuTitle">报表管理</h2>
                    <div class="menu_ul_div" id="menu_ul_div_3"

                         style="display:none;">
                        <ul id="menu3_ul" class="menu_ul">
                            <li class="menuItem"><a href="${path}/report/initReport.action">拜访量报表</a></li>
                        </ul>
                    </div>


                    <h2 id="menu4" class="menuTitle">系统设置</h2>
                    <div class="menu_ul_div" id="menu_ul_div_4"

                         style="display:none;">
                        <ul id="menu4_ul" class="menu_ul">
                            <li class="menuItem"><a href="${path}/system/search.action">员工设置</a></li>
                            <li class="menuItem"><a href="${path}/announcement/search.action">公告管理</a></li>
                            <li class="menuItem"><a href="${path}/system/elses.action">其他设置</a></li>
                        </ul>
                    </div>

                </div>
            </div>
        </td>
        <td style="vertical-align: top;">
            <div class="main_right">



                <link rel="stylesheet" href="${path}/css/themes/base/jquery.ui.all.css">
                <script src="${path}/js/jquery-1.7.2.js"></script>
                <script src="${path}/js/jquery.ui.core.js"></script>
                <script src="${path}/js/jquery.ui.widget.js"></script>
                <script src="${path}/js/jquery.ui.button.js"></script>
                <link rel="stylesheet" href="${path}/css/demos.css">

                <link rel="stylesheet" href="${path}/css/icons.css">

                <script src="${path}/js/icons.js"></script>

                <script type="text/javascript">
                    //点查询
                    function submitForm() {
                       // document.getElementById("pageNumber").value = 1;
                        document.myForm.submit();
                    }
                </script>

                <script type="text/javascript">
                    $(function() {
                        //分配点击
                        $("#dispatch")
                            .click(
                                function() {
                                    var ids = "";
                                    for ( var i = 0; i < $(".checkboxes").length; i++) {
                                        if ($(".checkboxes")[i].checked == true) {
                                            if (ids == "") {
                                                ids += $(".checkboxes")[i].value;
                                            } else {
                                                ids += "," + $(".checkboxes")[i].value;
                                            }
                                        }
                                    }
                                    /**
                                     * 弹出一个小窗口
                                     */

                                    var config = "resizable:no;center:yes;dialogWidth:300px;dialogHeight:200px;dialogTop:200px;dialogLeft:150px";
                                    showModalDialog("initDispatch.action?customers="
                                        + ids, document, config);
                                });

                        $("#delete")
                            .click(
                                function() {
                                    /**
                                     * 让用户先选中在删除
                                     */
                                    var count=0;
                                    for ( var i = 0; i < $(".checkboxes").length; i++) {
                                        if( $(".checkboxes")[i].checked==true){
                                            count++;
                                        }
                                    }
                                    if(count==0){
                                        alert("请先选中！！！")
                                        return;
                                    }

                                    if (window.confirm("是否确认删除")) {
                                        var ids = "";
                                        for ( var i = 0; i < $(".checkboxes").length; i++) {
                                            if ($(".checkboxes")[i].checked == true) {
                                                if (ids == "") {
                                                    ids += $(".checkboxes")[i].value;
                                                } else {
                                                    ids += ","
                                                        + $(".checkboxes")[i].value;
                                                }
                                            }
                                        }
                                        location.href = "${path}/customer/delete.action?customers="
                                            + ids;
                                    }
                                    ;
                                });

                        $("#pickCustomer").click(function() {
                            /**
                             * 让用户先选中在删除
                             */
                            var count=0;
                            for ( var i = 0; i < $(".checkboxes").length; i++) {
                                if( $(".checkboxes")[i].checked==true){
                                    count++;
                                }
                            }
                            if(count==0){
                                alert("请先选中！！！")
                                return;
                            }

                            var ids = "";
                            for ( var i = 0; i < $(".checkboxes").length; i++) {
                                if ($(".checkboxes")[i].checked == true) {
                                    if (ids == "") {
                                        ids += $(".checkboxes")[i].value;
                                    } else {
                                        ids += "," + $(".checkboxes")[i].value;
                                    }
                                }
                            }
                            location.href = "${path}/customer/pick.action?customers=" + ids;
                        });
                    });
                </script>
                <div class="content">
                    <div class="pageHead">
                        <table>
                            <tr>
                                <th width="8">
                                    <img src="${path}/images/c_l.gif" height="31" width="8" />
                                </th>
                                <th align="left" class="title_area">
                                    当前位置：客户管理 &gt; 公海客户
                                </th>
                                <th width="9">
                                    <img src="${path}/images/c_r.gif" height="31" width="9">
                                </th>
                            </tr>
                        </table>
                    </div>
                    <!-- 将url相同的路径的连接字符串存放到一个变量中 方便下面获取 -->
                    <c:set var="url"
                           value="${path}/customer/searchSea.action?name=${customer.name}&address=${customer.address}&level=${customer.level}&source=${customer.source}"></c:set>
                    <div class="pageBody">
                        <form id="searchSea" name="myForm" action="${path}/customer/searchSea.action" method="post">
                            <%--<input type="hidden" name="pager.pageNumber" value="1" id="pageNumber"/>  --%>
                            <table class="mytable fullWidth">
                                <tr>
                                    <th>
                                        客户名称
                                    </th>
                                    <td>
                                        <input type="text" name="name" value="" id="custName"/>
                                    </td>
                                    <th>
                                        客户地址
                                    </th>
                                    <td>
                                        <input type="text" name="address" value="" id="searchSea_customer_address"/>
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        客户来源
                                    </th>
                                    <td>
                                        <input type="radio" name="source" value="VISIT"
                                               id="source-1"        />
                                        <label for="source-1" class="checkboxLabel">上门拜访</label>
                                        <input type="radio" name="source" value="WEB_SEARCH"
                                               id="source-2"        />
                                        <label for="source-2" class="checkboxLabel">网络搜索</label>
                                        <input type="radio" name="source" value="YELLOW_PAGE"
                                               id="source-3"        />
                                        <label for="source-3" class="checkboxLabel">企业黄页</label>
                                        <input type="radio" name="source" value="INTRODUCE"
                                               id="source-4"        />
                                        <label for="source-4" class="checkboxLabel">转介绍</label>
                                        <input type="radio" name="source" value="WALK_IN"
                                               id="source-5"        />
                                        <label for="source-5" class="checkboxLabel">客户来访</label>
                                        <%--<input type="hidden" id="__multiselect_searchSea_source" name="__multiselect_source"--%>
                                               <%--value=""        />--%>
                                    </td>
                                    <th>
                                        客户等级
                                    </th>
                                    <td>
                                        <input type="radio" name="level" value="ONE"
                                               id="level-1"   />
                                        <%--<input type="checkbox" name="level" value="ONE"--%>
                                               <%--id="level-1"        />--%>
                                        <label for="level-1" class="checkboxLabel">★</label>
                                        <%--<input type="checkbox" name="level" value="TWO"--%>
                                               <%--id="level-2"        />--%>
                                        <input type="radio" name="level" value="TWO"
                                               id="level-2"   />
                                        <label for="level-2" class="checkboxLabel">★★</label>

                                        <%--<input type="checkbox" name="level" value="THREE"--%>
                                               <%--id="level-3"        />--%>
                                        <input type="radio" name="level" value="THREE"
                                               id="level-3"   />
                                        <label for="level-3" class="checkboxLabel">★★★</label>

                                        <%--<input type="checkbox" name="level" value="FOUR"--%>
                                               <%--id="level-4"        />--%>
                                        <input type="radio" name="level" value="FOUR"
                                               id="level-4"   />
                                        <label for="level-4" class="checkboxLabel">★★★★</label>

                                        <%--<input type="checkbox" name="level" value="FIVE"--%>
                                               <%--id="level-5"        />--%>
                                        <input type="radio" name="level" value="FIVE"
                                               id="level-5"   />
                                        <label for="level-5" class="checkboxLabel">★★★★★</label>

                                        <input type="hidden"
                                               id="__multiselect_searchSea_level"
                                               name="__multiselect_level" value=""        />
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">
                                        <div class="buttonBar">
                                            <button id="btnSearch" onclick="submitForm()">查询</button>
                                            <button id="btnReset" type="reset">重置</button>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </form>




                        <div class="pager-container" >
                            <div style="height: 30px"></div>

                            <table class="mytable resultTable fullWidth">
                                <tr>
                                    <th style="width: 30px">
                                        序号
                                    </th>
                                    <th style="width: 200px">
                                        归还公海日期
                                    </th >
                                    <th style="width: 200px">
                                        客户名称
                                    </th>
                                    <th style="width: 200px">
                                        主联系人
                                    </th>
                                    <th style="width: 200px">
                                        客户地址
                                    </th>
                                    <th style="width: 200px">
                                        操作
                                    </th>

                                </tr>

                                <tr>
                                    <c:if test="${ empty pageCus.list}">
                                        <div style="text-align: center">
                                            <h2 style="color: red">对不起！没有该类型的用户</h2>
                                            <img src="${path}/images/noimg.jpg" style="width: 100px ;height:100px" />
                                        </div>
                                    </c:if>

                                    <c:if test="${! empty pageCus.list}">
                                        <c:forEach items="${pageCus.list}" var="cus">
                                            <td>
                                        <input class="checkboxes" type="checkbox"
                                               value="${cus.id}">
                                            </td>
                                            <td>
                                            ${cus.backSeaDate}
                                            </td>
                                             <td>
                                        <a href="${path}/customer/info.action?id="+${cus.id }  >${cus.name } </a>
                                        </td>
                                        <td>
                                            ${cus.majorContact}
                                        </td>
                                        <td>
                                            ${cus.address}
                                        </td>
                                        <td>
                                            <a href="${path}/customer/visitRecordList.action?id=${cus.id}">拜访记录</a>
                                            <a href="${path}/customer/contactList.action?id=${cus.id}">联系人</a>
                                        </td>
                                </tr>
                                        </c:forEach>
                            </c:if>
                                <tr>
                                    <td style="text-align: left" colspan="5">
                                        <input id="pickCustomer" type="button"
                                               class="mybutton pickCustomer" value="捡选客户">
                                        &nbsp;


                                        <input type="button" id="dispatch"
                                               class="mybutton pickCustomer" value="分配">
                                        &nbsp;
                                        <input type="button" id="delete" class="mybutton pickCustomer"
                                               value="删除">
                                    </td>
                                </tr>
                                <tr>
                                    <td style="color: red" colspan="6">

                                    </td>
                                </tr>
                            </table>
                            <div class="pager-container">



                                <script type="text/javascript">
                                    function pager(num){
                                        document.getElementById("pageNumber").value = num;
                                        document.myForm.submit();
                                    }
                                </script>

                                <ul class="pager">
                                    <li class="pageInfo">共${pageCus.totalCount}条记录,<li class="pageInfo">共${pageCus.pageCount}页，当前为第${pageCus.pageNumber}页</li>
                                    <!--首页-->


                                    <li class="firstPage">
                                            <a href="${url}&pageNumber=1">首页</a>
                                    </li>

                                    <!--上一页-->
                                    <c:if test="${pageCus.pageNumber!=1}">
                                        <li class="prePage">
                                            <a href="${url}&pageNumber=${pageCus.pageNumber-1}">上一页</a>
                                        </li>
                                    </c:if>
                                    <!-- 如果已经是第一页  就不能跳转了 -->
                                    <c:if test="${pageCus.pageNumber==1}">
                                        <li class="disabled">
                                            <a>上一页</a>
                                        </li>
                                    </c:if>

                                    <!--下一页-->

                                    <c:if test="${pageCus.pageNumber!=pageCus.pageCount}">
                                        <li class="nextPage">
                                            <a href="${url}&pageNumber=${pageCus.pageNumber+1}">下一页</a>
                                        </li>
                                    </c:if>
                                    <c:if test="${pageCus.pageNumber==pageCus.pageCount}">
                                        <li class="nextPage">
                                            <a>下一页</a>
                                        </li>
                                    </c:if>


                                    <!--末页-->
                                    <c:if test="${pageCus.pageNumber!=pageCus.pageCount}">
                                        <li class="lastPage">
                                            <a href="${url}&pageNumber=${pageCus.pageCount}">末页</a>
                                        </li>
                                    </c:if>
                                    <c:if test="${pageCus.pageNumber==pageCus.pageCount}">
                                    <li class="lastPage">
                                        <a>末页</a>
                                    </li>
                                    </c:if>
                                </ul>
                            </div>

                        </div>
                    </div>
                </div>

            </div>
        </td>
    </tr>
</table>

<!--尾部-->
<div class="footer">


    <div class="seperator"></div>
    <p>
        <a href="http://www.sztzedu.com">公司主站</a>|
        <a href="#">隐私策略</a>|
        <a href="#">服务条款</a>&nbsp;
        苏州天智教育公司&reg;版权所有 2012-2015
    </p>

</div>
</body>
</html>